#pragma once
#include <Windows.h>

class SIX_Mutex {
public:
	CRITICAL_SECTION cc;
public:
	SIX_Mutex();
	~SIX_Mutex();
	void Enter();
	void Leave();
	int ShowLockCount();
};

class SIX_Lock
{
public:
	SIX_Lock(SIX_Mutex *LockObj)
	{
		m_LockObj = LockObj;
		if (m_LockObj->ShowLockCount() != -1)
			return;
		m_LockObj->Enter();
	}
	~SIX_Lock()
	{
		if (m_LockObj->ShowLockCount() != -2)
			return;
		m_LockObj->Leave();
	}
private:
	SIX_Mutex *m_LockObj;
};